package org.sport.repository;


import org.sport.model.entityModel.SporthistorytableEntity;
import org.sport.model.entityModel.UsertableEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.sql.Timestamp;
import java.util.List;


@Repository
public interface SporthistorytableRepository extends JpaRepository<SporthistorytableEntity,Integer> {



    @Transactional
    @Query("select spo from SporthistorytableEntity spo where spo.usertableByUserId =?1")
    public List<SporthistorytableEntity> findSpoByUserId(UsertableEntity usertableEntity);

    @Transactional
    @Query("select spo from SporthistorytableEntity spo where spo.usertableByUserId =?1 and spo.startTiem=?2")
    public SporthistorytableEntity findSpoByUserIdAndStartTime(UsertableEntity usertableEntity, Timestamp startTiem);

    @Transactional
    @Query("select spo from SporthistorytableEntity spo where spo.startTiem=?1")
    public SporthistorytableEntity findSpoByStartTime(Timestamp startTiem);

}
